package com.zhangshihao.service.impl;

import com.zhangshihao.domain.Book;
import com.zhangshihao.mapper.BookMapper;
import com.zhangshihao.service.IBookService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
@AllArgsConstructor
public class BookService implements IBookService {
    private BookMapper bookMapper;

    @Override
    public int addBook(Book book) {
        return bookMapper.insertBook(book);
    }

    @Override
    public int deleteBook(int id) {
        return bookMapper.deleteBook(id);
    }

    @Override
    public int updateBook(Book book) {
        return bookMapper.updateBook(book);
    }

    @Override
    public Book getBookById(int id) {
        return bookMapper.selectBookById(id);
    }

    @Override
    public List<Book> getAllBooks(Book book) {
        return bookMapper.selectAllBook(book);
    }
}